Network Requests
-
Sends HTTP network requests.
BMSURLSession
is an alternative toBaseRequest
that provides more flexibility and control over requests and their responses.It is built as a wrapper around Swift’s URLSession API that incorporates Bluemix Mobile Services. It automatically gathers Mobile Analytics data on each network request, and can be used to access backends that are protected by Mobile Client Access.
Currently,
See moreBMSURLSession
only supports URLSessionDataTask and URLSessionUploadTask.Declaration
Swift
public struct BMSURLSession: NetworkSession
-
Sends HTTP network requests.
BaseRequest
is a simpler alternative toBMSURLSession
that requires no familiarity with Swift’s URLSession API.When building a BaseRequest object, all components of the HTTP request must be provided in the initializer, except for the
requestBody
, which can be supplied as Data when sending the request viasend(requestBody:completionHandler:)
.Important
It is recommended to use theRequest
class instead ofBaseRequest
, since it will replaceBaseRequest
in the future.Declaration
Swift
open class BaseRequest: NSObject, URLSessionTaskDelegate
-
Sends HTTP network requests.
Request
is functionally equivalent toBaseRequest
. For more information on how to useRequest
, see the documentation forBaseRequest
.Declaration
Swift
open class Request: BaseRequest